<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>老师测验章节批改窗口下拉列表</title>
		<link rel="stylesheet" type="text/css" href="../css/api.css"/>
		<style>
			body {
				background: #FFFFFF;
				margin: 0px;
			}
			.item {
				width: 100%;
				height: 40px;
				line-height: 40px;
				display: -webkit-box;
			}
			.item img {
				height: 8px;
				padding-left: 40px;
				padding-right: 15px;
				padding-bottom: 2px;
			}
			.item_cut {
				width: 100%;
				height: 1px;
				background: #d9d9d9;
			}
			.item_text {
				font-size: 13px;
				display: block;
				-webkit-margin-before: 0em;
				-webkit-margin-after: 0em;
				-webkit-margin-start: 0px;
				-webkit-margin-end: 0px;
			}
			li {
				list-style-type: none;
				height: auto;
				width: 100%;
			}
			ul {
				display: block;
				list-style-type: disc;
				-webkit-margin-before: 0em;
				-webkit-margin-after: 0em;
				-webkit-margin-start: 0px;
				-webkit-margin-end: 0px;
				-webkit-padding-start: 0px;
			}
		</style>
	</head>
	<body>
		<div id="list_type"></div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script src="../../script/common.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/mui.min.js"></script>
	<script type="text/javascript">
		var type_list = new Object();
		var type = "";
		var types = [];
		var lx = "";
		var fx = "";
		var allStudentClass = {
			id : '',
			title : '全部'
		};
		apiready = function() {
			type = api.pageParam.type;
			grabClassData();
//          writelist();
		};
		//获取数据
		function grabClassData() {
			var params = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				pid : api.pageParam.pid,
			};
			cfnetppPOST(url_getClasslist, params, true, function(data, status) {
			
				api.hideProgress();
				if (status == 'success') {
					if (data.code == 200) {
						var classDatas = data.data;
						//						var classDatas = jsonData.list;
						if (classDatas.constructor == Array && classDatas.length > 0) {
							if (classDatas[0].id != '') {
								classDatas.unshift(allStudentClass);
								//插入“全部”选项
							}
							$api.setStorage('class', classDatas);
							type_list = $api.getStorage('class');
							writelist();
						} else {
							api.closeFrame({
							});
							api.toast({
								msg : '数据请求出错！！！'
							});
						}
					} else {
					}
				} else {
				}
			});
		}

		function writelist() {
			var list_date = "";
			list_date = list_date + "<ul>";
			types = [];
			if (type == "0") {
				for (var i = 0; i < type_list.length; i++) {
					var item = {};
					item.name = type_list[i].title;
					item.id = type_list[i].id;
					types.push(item);
				}
				if ($api.getStorage("lx") == "") {
					for (var i = 0; i < types.length; i++) {
						if (i == 0) {
							list_date = list_date + '<li> <div class="item" onclick="checkli(' + i + ')"> <img id="gwtype' + i + '" src="../../icon/icon_duigou.png" /> <p class="item_text">' + types[i].name + '</p> </div> <div class="item_cut"></div> </li>';
						} else {
							list_date = list_date + '<li> <div class="item" onclick="checkli(' + i + ')"> <img id="gwtype' + i + '" src="../../icon/icon_duigoub.png" /> <p class="item_text">' + types[i].name + '</p> </div> <div class="item_cut"></div> </li>';
						}
					}
				} else {
					for (var i = 0; i < types.length; i++) {
						if (types[i].name == $api.getStorage("lx")) {
							list_date = list_date + '<li> <div class="item" onclick="checkli(' + i + ')"> <img id="gwtype' + i + '" src="../../icon/icon_duigou.png" /> <p class="item_text">' + types[i].name + '</p> </div> <div class="item_cut"></div> </li>';
						} else {
							list_date = list_date + '<li> <div class="item" onclick="checkli(' + i + ')"> <img id="gwtype' + i + '" src="../../icon/icon_duigoub.png" /> <p class="item_text">' + types[i].name + '</p> </div> <div class="item_cut"></div> </li>';
						}
					}
				}
			}
			if (type == "1") {
				var type1 = api.pageParam.type1;
				//判断是作业还是阅卷
				if (type1 == 1) {//1；测演
					var list = ['全部', '已阅', '未阅'];
				} else if (type1 == 2) {
					var list = ['全部', '已阅', '未阅', '驳回'];
				}
				for (var i = 0; i < list.length; i++) {
					var item = {};
					item.name = list[i];
					types.push(item);
				}
				if ($api.getStorage("fx") == "") {
					for (var i = 0; i < types.length; i++) {
						if (i == 0) {
							list_date = list_date + '<li> <div class="item" onclick="checkli(' + i + ')"> <img id="gwtype' + i + '" src="../../icon/icon_duigou.png" /> <p class="item_text">' + types[i].name + '</p> </div> <div class="item_cut"></div> </li>';
						} else {
							list_date = list_date + '<li> <div class="item" onclick="checkli(' + i + ')"> <img id="gwtype' + i + '" src="../../icon/icon_duigoub.png" /> <p class="item_text">' + types[i].name + '</p> </div> <div class="item_cut"></div> </li>';
						}
					}
				} else {
					for (var i = 0; i < types.length; i++) {
						if (types[i].name == $api.getStorage("fx")) {
							list_date = list_date + '<li> <div class="item" onclick="checkli(' + i + ')"> <img id="gwtype' + i + '" src="../../icon/icon_duigou.png" /> <p class="item_text">' + types[i].name + '</p> </div> <div class="item_cut"></div> </li>';
						} else {
							list_date = list_date + '<li> <div class="item" onclick="checkli(' + i + ')"> <img id="gwtype' + i + '" src="../../icon/icon_duigoub.png" /> <p class="item_text">' + types[i].name + '</p> </div> <div class="item_cut"></div> </li>';
						}
					}
				}
			}
			list_date = list_date + "</ul>";
			x = document.getElementById("list_type");
			x.innerHTML = list_date;
		}

		function checkli(ids) {
			//更改item中图片
			$("#gwtype" + ids).attr("src", "../../icon/icon_duigou.png");
			var arr = new Array();
			// 保存选中的选项
			if (type == "0") {
				lx = types[ids].name;
				arr = {
					name : types[ids].name,
					id : types[ids].id,
				}
				$api.setStorage("lx", lx);
			}
			if (type == "1") {//方向
				fx = types[ids].name;
				arr = {
					name : types[ids].name,
					id : ids,
				}
				$api.setStorage("fx", fx);
			}
			//关闭frame
			api.sendEvent({
				name : 'mark_close'
			});
			api.sendEvent({
				name : 'close_mask'
			});
			api.sendEvent({
				name : 'item_point',
				extra : {
					data : arr,
					type : type
				}
			});
			//用选中的参数请求数据
		}
	</script>
</html>